package com.plian.system.wrapper.om;

import com.plian.system.dto.om.module.ModuleChildDTO;
import com.plian.system.entity.om.module.ModuleChild;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.om.module.ModuleChildVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: takeoff
 * @create: 2022/3/28 上午10:36
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface ModuleChildWrapper extends BaseWrapper<ModuleChild, ModuleChildDTO, ModuleChildVO> {

    @Override
    @Mappings(value = {
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "orgId", target = "orgName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "childOrgId", target = "childOrgName", qualifiedByName = ORG_ID_TO_NAME)
    })
    ModuleChildVO entityToVO(ModuleChild entity);

}
